<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>06-让元素水平垂直居中方式</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
            background-color: yellowgreen;
            position: absolute;
            left: 50%;
            top: 50%;
            /* transform: translate(-50%, -50%); */
            margin-left: -150px;
            margin-top: -150px;
        }
    </style>
</head>

<body>
    <div class="box"></div>
</body>

</html>